﻿using Ideaa.Data.Infrastructure;
using System;
using System.Linq;
using PersistedModels = Ideaa.Data.Models;
using DomainModels = Ideaa.Domain.Models.Idea;
using System.Data.Entity;
using AutoMapper;

namespace Ideaa.Data.Repositories
{
    public interface ISuggestionRepository
    {
        void AddSuggestion(DomainModels.Suggestion suggestion);
    }

    public class SuggestionRepository : GenericRepository<PersistedModels.Suggestion>, ISuggestionRepository
    {
        public SuggestionRepository(DbContext context)
            : base(context)
        {

        }

        public void AddSuggestion(DomainModels.Suggestion suggestion)
        {
            PersistedModels.Suggestion persistedModel = Mapper.Map<PersistedModels.Suggestion>(suggestion);

            base.Add(persistedModel);
        }
    }
}
